/*
 * 闰年相关的问题v4.0——计算心跳数（4分）
 *
 * v1.0，见：04-week04/2_Whether_Leap_Year_Or_Not.c
 * v2.0，见：06-week06/9_Output_How_Many_Days_Do_A_Month_Has_with_Leap_Year_Considered.c
 * v3.0，见：Weekly_Programming_Test/05-week05/3_Leap_Year_Related_Issues_v3__Calculating_Leap_Years.c
 */

#include <stdio.h>

#define HEART_RATE_PER_MIN 75
#define MIN_PER_DAY 1440

int main() {
	setbuf(stdout, NULL);

	// NOTE: Variable declaration
	int birth_year, this_year;
	unsigned long count =0;


	// NOTE: Inputs
	printf("Input your birth year:");
	scanf("%d", &birth_year);

	printf("Input this year:");
	scanf("%d", &this_year);


	// NOTE: Process
	for (int i = birth_year; i < this_year; ++i) {
		if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) {
			// 闰年情况下，累加一年的心跳总数
			count += (HEART_RATE_PER_MIN * MIN_PER_DAY * 366);
		} else {
			// 非闰年情况下，累加一年的心跳总数
			count += (HEART_RATE_PER_MIN * MIN_PER_DAY * 365);
		}
	}


	// NOTE: Outputs
	printf("The heart beats in your life: %lu",count);


	// NOTE: Ending
	return 0;
}